<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>miniFOC: hardware/flash.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Acme_LOGO.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">miniFOC<span id="projectnumber">&#160;1.0.2</span>
   </div>
   <div id="projectbrief">This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_42e555215cde261dd5295a864caa3e52.html">hardware</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">flash.c</div></div>
</div><!--header-->
<div class="contents">
<a href="flash_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="comment">/**************************************************************************/</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &quot;<a class="code" href="main_8h.html">main.h</a>&quot;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"><a class="line" href="flash_8c.html#aa281b78d45017220d214a274f0c3e2c9">   17</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="flash_8c.html#aa281b78d45017220d214a274f0c3e2c9">flash_write_parameters</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> buffer[11] = {<a class="code hl_variable" href="encoder_8c.html#a562eacc7259f25574b1ab8ce9d7c6a3e">machine_angle_offset</a>, <a class="code hl_variable" href="foc_8c.html#ad335385ea3909d9485703d97735b34ca">phase_sequence</a>, 0x00000000UL, 0x00000000UL, 0x00000000UL,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span>                               0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL};</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span>    buffer[2] = <a class="code hl_function" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a>(<a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a1f7add0f84d583bc2eceb290d6c4cc06">kp</a>);</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span>    buffer[3] = <a class="code hl_function" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a>(<a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a050993b7ca6c97e62c1020017f716b91">ki</a>);</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span>    buffer[4] = <a class="code hl_function" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a>(<a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#ae7a5c6018507bb1361fcca170e069b9c">kd</a>);</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span>    buffer[5] = <a class="code hl_function" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a>(<a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a51379d672c255e751fb020ef2394a8f0">sum_maximum</a>);</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span>    buffer[6] = <a class="code hl_function" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a>(<a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a1f7add0f84d583bc2eceb290d6c4cc06">kp</a>);</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span>    buffer[7] = <a class="code hl_function" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a>(<a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a050993b7ca6c97e62c1020017f716b91">ki</a>);</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span>    buffer[8] = <a class="code hl_function" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a>(<a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#ae7a5c6018507bb1361fcca170e069b9c">kd</a>);</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno">   27</span>    buffer[9] = <a class="code hl_function" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a>(<a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a51379d672c255e751fb020ef2394a8f0">sum_maximum</a>);</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span>    buffer[10] = <a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000040UL);</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span>    <a class="code hl_function" href="flash_8c.html#ac0d03d56de1c227449fe6628980cc12f">flash_erase_page</a>();</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span>    <a class="code hl_function" href="flash_8c.html#a976a3c0f32d24027d5c47073653c9cfa">flash_program_word</a>(0x00000000UL, buffer, 10);</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span>}</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="flash_8c.html#aaef765344f91439176e3223a0f51f4d0">   37</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="flash_8c.html#aaef765344f91439176e3223a0f51f4d0">flash_read_parameters</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span>    <a class="code hl_variable" href="encoder_8c.html#a562eacc7259f25574b1ab8ce9d7c6a3e">machine_angle_offset</a> = <a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000000UL);</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span>    <a class="code hl_variable" href="foc_8c.html#ad335385ea3909d9485703d97735b34ca">phase_sequence</a> = <a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000004UL);</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>    <a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a1f7add0f84d583bc2eceb290d6c4cc06">kp</a> = <a class="code hl_function" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a>(<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000008UL));</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    <a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a050993b7ca6c97e62c1020017f716b91">ki</a> = <a class="code hl_function" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a>(<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000012UL));</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span>    <a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#ae7a5c6018507bb1361fcca170e069b9c">kd</a> = <a class="code hl_function" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a>(<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000016UL));</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>    <a class="code hl_variable" href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a51379d672c255e751fb020ef2394a8f0">sum_maximum</a> = <a class="code hl_function" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a>(<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000020UL));</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    <a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a1f7add0f84d583bc2eceb290d6c4cc06">kp</a> = <a class="code hl_function" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a>(<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000024UL));</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    <a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a050993b7ca6c97e62c1020017f716b91">ki</a> = <a class="code hl_function" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a>(<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000028UL));</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span>    <a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#ae7a5c6018507bb1361fcca170e069b9c">kd</a> = <a class="code hl_function" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a>(<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000032UL));</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>    <a class="code hl_variable" href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a>.<a class="code hl_variable" href="struct_p_i_d___structure__t.html#a51379d672c255e751fb020ef2394a8f0">sum_maximum</a> = <a class="code hl_function" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a>(<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000036UL));</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span>    <span class="keywordflow">if</span> (<a class="code hl_variable" href="encoder_8c.html#a562eacc7259f25574b1ab8ce9d7c6a3e">machine_angle_offset</a> &gt; 4096 || <a class="code hl_variable" href="foc_8c.html#ad335385ea3909d9485703d97735b34ca">phase_sequence</a> &gt; 1) {</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>        <a class="code hl_define" href="led_8h.html#a1b0a0f843bc25a0545eaa62a240ea3b2">led_on</a>();</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span>        <span class="keywordflow">while</span> (1);</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span>    }</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>    <span class="keywordflow">if</span> (<a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(0x00000040UL) != 0xA5A5A5A5UL)</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>        <a class="code hl_variable" href="pid_8c.html#a48934d9569b54761658f7fe0484db10c">pid_parameter_available_flag</a> = 0;</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>}</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"><a class="line" href="flash_8c.html#ac0d03d56de1c227449fe6628980cc12f">   60</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="flash_8c.html#ac0d03d56de1c227449fe6628980cc12f">flash_erase_page</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>    <span class="comment">/* unlock the flash program/erase controller */</span></div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>    fmc_unlock();</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span>    fmc_flag_clear(FMC_FLAG_END | FMC_FLAG_WPERR | FMC_FLAG_PGERR);</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span>    <span class="comment">/* erase the flash page */</span></div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span>    fmc_page_erase(<a class="code hl_define" href="config_8h.html#a17c58df3fba73bc0fe08b011bc3d404f">FMC_WRITE_START_ADDR</a>);</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>    fmc_flag_clear(FMC_FLAG_END | FMC_FLAG_WPERR | FMC_FLAG_PGERR);</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span> </div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span>    <span class="comment">/* lock the main FMC after the erase operation */</span></div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>    fmc_lock();</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>}</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"><a class="line" href="flash_8c.html#a976a3c0f32d24027d5c47073653c9cfa">   80</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="flash_8c.html#a976a3c0f32d24027d5c47073653c9cfa">flash_program_word</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> addr, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *data, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> counter) {</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span>    <span class="comment">/* unlock the flash program/erase controller */</span></div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>    fmc_unlock();</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span> </div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>    <span class="comment">/* program flash */</span></div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>    <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> data_cnt = 0; data_cnt &lt; counter; data_cnt++) {</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>        fmc_word_program(addr + <a class="code hl_define" href="config_8h.html#a17c58df3fba73bc0fe08b011bc3d404f">FMC_WRITE_START_ADDR</a> + 4 * data_cnt, data[data_cnt]);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span>        fmc_flag_clear(FMC_FLAG_END | FMC_FLAG_WPERR | FMC_FLAG_PGERR);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span>    }</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno">   89</span> </div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno">   90</span>    <span class="comment">/* lock the main FMC after the program operation */</span></div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span>    fmc_lock();</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span>}</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span> </div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"><a class="line" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">   99</a></span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code hl_function" href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> addr) {</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>    <span class="comment">/* redirect the address to access memory */</span></div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>    addr = <a class="code hl_define" href="config_8h.html#a17c58df3fba73bc0fe08b011bc3d404f">FMC_WRITE_START_ADDR</a> + addr;</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span>    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *ptrd = (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *) addr;</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span>    <span class="keywordflow">return</span> (*ptrd);</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>}</div>
<div class="ttc" id="aconfig_8h_html_a17c58df3fba73bc0fe08b011bc3d404f"><div class="ttname"><a href="config_8h.html#a17c58df3fba73bc0fe08b011bc3d404f">FMC_WRITE_START_ADDR</a></div><div class="ttdeci">#define FMC_WRITE_START_ADDR</div><div class="ttdoc">User flash space start address, 1KB user flash.</div><div class="ttdef"><b>Definition:</b> <a href="config_8h_source.html#l00042">config.h:42</a></div></div>
<div class="ttc" id="aencoder_8c_html_a562eacc7259f25574b1ab8ce9d7c6a3e"><div class="ttname"><a href="encoder_8c.html#a562eacc7259f25574b1ab8ce9d7c6a3e">machine_angle_offset</a></div><div class="ttdeci">volatile unsigned short machine_angle_offset</div><div class="ttdoc">mechanical angle offset, which is used to align the mechanical angle with the zero point of the elect...</div><div class="ttdef"><b>Definition:</b> <a href="encoder_8c_source.html#l00023">encoder.c:23</a></div></div>
<div class="ttc" id="aflash_8c_html_a976a3c0f32d24027d5c47073653c9cfa"><div class="ttname"><a href="flash_8c.html#a976a3c0f32d24027d5c47073653c9cfa">flash_program_word</a></div><div class="ttdeci">void flash_program_word(unsigned int addr, unsigned int *data, unsigned short counter)</div><div class="ttdoc">program flash word to address</div><div class="ttdef"><b>Definition:</b> <a href="flash_8c_source.html#l00080">flash.c:80</a></div></div>
<div class="ttc" id="aflash_8c_html_a9b7a8ed62067617696d1fa44e1c3117c"><div class="ttname"><a href="flash_8c.html#a9b7a8ed62067617696d1fa44e1c3117c">flash_read_word</a></div><div class="ttdeci">unsigned int flash_read_word(unsigned int addr)</div><div class="ttdoc">read flash word from address</div><div class="ttdef"><b>Definition:</b> <a href="flash_8c_source.html#l00099">flash.c:99</a></div></div>
<div class="ttc" id="aflash_8c_html_aa281b78d45017220d214a274f0c3e2c9"><div class="ttname"><a href="flash_8c.html#aa281b78d45017220d214a274f0c3e2c9">flash_write_parameters</a></div><div class="ttdeci">void flash_write_parameters(void)</div><div class="ttdoc">program all parameters to flash</div><div class="ttdef"><b>Definition:</b> <a href="flash_8c_source.html#l00017">flash.c:17</a></div></div>
<div class="ttc" id="aflash_8c_html_aaef765344f91439176e3223a0f51f4d0"><div class="ttname"><a href="flash_8c.html#aaef765344f91439176e3223a0f51f4d0">flash_read_parameters</a></div><div class="ttdeci">void flash_read_parameters(void)</div><div class="ttdoc">read all parameters from flash</div><div class="ttdef"><b>Definition:</b> <a href="flash_8c_source.html#l00037">flash.c:37</a></div></div>
<div class="ttc" id="aflash_8c_html_ac0d03d56de1c227449fe6628980cc12f"><div class="ttname"><a href="flash_8c.html#ac0d03d56de1c227449fe6628980cc12f">flash_erase_page</a></div><div class="ttdeci">void flash_erase_page(void)</div><div class="ttdoc">erase flash page in last sector</div><div class="ttdef"><b>Definition:</b> <a href="flash_8c_source.html#l00060">flash.c:60</a></div></div>
<div class="ttc" id="afoc_8c_html_ad335385ea3909d9485703d97735b34ca"><div class="ttname"><a href="foc_8c.html#ad335385ea3909d9485703d97735b34ca">phase_sequence</a></div><div class="ttdeci">volatile unsigned char phase_sequence</div><div class="ttdoc">motor phase sequence flag variable</div><div class="ttdef"><b>Definition:</b> <a href="foc_8c_source.html#l00024">foc.c:24</a></div></div>
<div class="ttc" id="aled_8h_html_a1b0a0f843bc25a0545eaa62a240ea3b2"><div class="ttname"><a href="led_8h.html#a1b0a0f843bc25a0545eaa62a240ea3b2">led_on</a></div><div class="ttdeci">#define led_on()</div><div class="ttdoc">turn on LED</div><div class="ttdef"><b>Definition:</b> <a href="led_8h_source.html#l00016">led.h:16</a></div></div>
<div class="ttc" id="amain_8h_html"><div class="ttname"><a href="main_8h.html">main.h</a></div><div class="ttdoc">main function Header File</div></div>
<div class="ttc" id="apid_8c_html_a48934d9569b54761658f7fe0484db10c"><div class="ttname"><a href="pid_8c.html#a48934d9569b54761658f7fe0484db10c">pid_parameter_available_flag</a></div><div class="ttdeci">unsigned char pid_parameter_available_flag</div><div class="ttdoc">flag variable for PID parameter availability</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00016">pid.c:16</a></div></div>
<div class="ttc" id="apid_8c_html_aaa8f5bad87ffc78a20f06863ab6bad5c"><div class="ttname"><a href="pid_8c.html#aaa8f5bad87ffc78a20f06863ab6bad5c">angle_pid_handler</a></div><div class="ttdeci">volatile PID_Structure_t angle_pid_handler</div><div class="ttdoc">algorithm handler of PID angle loop</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00028">pid.c:28</a></div></div>
<div class="ttc" id="apid_8c_html_ab051c8f4a730b934b146f330514efd95"><div class="ttname"><a href="pid_8c.html#ab051c8f4a730b934b146f330514efd95">speed_pid_handler</a></div><div class="ttdeci">volatile PID_Structure_t speed_pid_handler</div><div class="ttdoc">algorithm handler of PID speed loop</div><div class="ttdef"><b>Definition:</b> <a href="pid_8c_source.html#l00024">pid.c:24</a></div></div>
<div class="ttc" id="astruct_p_i_d___structure__t_html_a050993b7ca6c97e62c1020017f716b91"><div class="ttname"><a href="struct_p_i_d___structure__t.html#a050993b7ca6c97e62c1020017f716b91">PID_Structure_t::ki</a></div><div class="ttdeci">float ki</div><div class="ttdoc">integral term coefficient in PID</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00026">pid.h:26</a></div></div>
<div class="ttc" id="astruct_p_i_d___structure__t_html_a1f7add0f84d583bc2eceb290d6c4cc06"><div class="ttname"><a href="struct_p_i_d___structure__t.html#a1f7add0f84d583bc2eceb290d6c4cc06">PID_Structure_t::kp</a></div><div class="ttdeci">float kp</div><div class="ttdoc">proportional term coefficient in PID</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00025">pid.h:25</a></div></div>
<div class="ttc" id="astruct_p_i_d___structure__t_html_a51379d672c255e751fb020ef2394a8f0"><div class="ttname"><a href="struct_p_i_d___structure__t.html#a51379d672c255e751fb020ef2394a8f0">PID_Structure_t::sum_maximum</a></div><div class="ttdeci">float sum_maximum</div><div class="ttdoc">maximum of anti saturation integral in PID</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00032">pid.h:32</a></div></div>
<div class="ttc" id="astruct_p_i_d___structure__t_html_ae7a5c6018507bb1361fcca170e069b9c"><div class="ttname"><a href="struct_p_i_d___structure__t.html#ae7a5c6018507bb1361fcca170e069b9c">PID_Structure_t::kd</a></div><div class="ttdeci">float kd</div><div class="ttdoc">differential term coefficient in PID</div><div class="ttdef"><b>Definition:</b> <a href="pid_8h_source.html#l00027">pid.h:27</a></div></div>
<div class="ttc" id="asystem_8c_html_a7bee5a9ca4038926b7fd4c38976d1481"><div class="ttname"><a href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a></div><div class="ttdeci">unsigned int float_to_int32(float data0)</div><div class="ttdoc">convert floating point numbers to int32 type data</div><div class="ttdef"><b>Definition:</b> <a href="system_8c_source.html#l00065">system.c:65</a></div></div>
<div class="ttc" id="asystem_8c_html_ade748eddd7c60c3bf4c67bce9c463545"><div class="ttname"><a href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a></div><div class="ttdeci">float int32_to_float(unsigned int data0)</div><div class="ttdoc">convert int32 to floating point numbers type data</div><div class="ttdef"><b>Definition:</b> <a href="system_8c_source.html#l00075">system.c:75</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2
</small></address>
</body>
</html>
